program PROB001;
var
  i, sum : longint;

begin
  sum := 0;
  for i := 1 to 999 do
    if (i mod 3 = 0) or (i mod 5 = 0) then inc(sum, i);
  writeln(sum);
end.
